anomality detection in DTS

reading files predicted in the first step and prepare functions

In [1]:
import pandas as pd
draw=pd.read_csv('draw')
#draw.to_csv('draw')
In [2]:
classes={0:'natural',
        1:'high negative speed',
        2: 'high depth temperature ratio',
        3:'anormal hight temperatute speed',
        4:'hight temperature speed',
        5:'anormal low depth temperature ratio',
        6: 'anormal hight depth temperature ratio',
        7:'anormal negative temperature speed'}
draw['class']=draw['class'].apply(lambda x: classes[x])

appliying downsimpling and drawing the original data with casses marked

In [3]:
depth=draw['Depth (m)'].drop_duplicates().values
selected_depths=[depth[i] for i in range(0,len(depth),5)]
s=draw[draw['Depth (m)'].isin(selected_depths)].reset_index(drop=True)
s['time']=pd.to_datetime(s['time'])
times=s['time'].drop_duplicates().values
selected_times=[times[i] for i in range(0,len(times),3)]
s=s[s['time'].isin(selected_times)].reset_index(drop=True)
s=s.sort_values(['time','Depth (m)'])

drawing in 3d for better understanding

In [4]:
import plotly as py
import plotly.express as px
df = px.data.iris()
fig = px.scatter_3d(s, x='time', y='temperature', z='Depth (m)',
              color='class',opacity=0.99,size_max=2)
fig.update_scenes(zaxis_autorange="reversed")
fig.update_layout(
    legend_title="please click on the colors bellew \nto filter points",
    title="distribution of temperature by time and depth",legend=dict(itemdoubleclick=False) )
fig.show()